package cn.arnold.offer.jianxin.test2;

import java.util.Arrays;

public class Main {


    public int kthSmallest(int[][] matrix, int m) {
        // write code here
        int r = matrix.length;
        int c = matrix[0].length;
        int[] temp = new int[r * c];
        int index = 0;
        for (int[] row : matrix) {
            for (int num : row) {
                temp[index++] = num;
            }
        }
        Arrays.sort(temp);
        return temp[m - 1];
    }
}
